import importlib


class PltTool:
    PLT_ENABLE = False
    plt = None

    def Init(self, enable):
        self.PLT_ENABLE = enable
        if enable:
            self.plt = importlib.import_module('matplotlib.pyplot')

    def ImagePltConf(self, row, col, index, img):
        if not self.PLT_ENABLE:
            return
        self.plt.subplot(row, col, index), self.plt.imshow(img)
        self.plt.xticks([]), self.plt.yticks([])

    def PltShow(self):
        if not self.PLT_ENABLE:
            return
        self.plt.show()
